define(['module', 'react', 'react-dom', 'Menu', "./Tile", "FontIcon", "Switch", "Button"], function (module, React, ReactDOM, Menu, Tile, FontIcon, Switch, Button) {
    'use strict';

    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    }

    var _createClass = function () {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }

        return function (Constructor, protoProps, staticProps) {
            if (protoProps) defineProperties(Constructor.prototype, protoProps);
            if (staticProps) defineProperties(Constructor, staticProps);
            return Constructor;
        };
    }();

    function _possibleConstructorReturn(self, call) {
        if (!self) {
            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        }

        return call && (typeof call === "object" || typeof call === "function") ? call : self;
    }

    function _inherits(subClass, superClass) {
        if (typeof superClass !== "function" && superClass !== null) {
            throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
        }

        subClass.prototype = Object.create(superClass && superClass.prototype, {
            constructor: {
                value: subClass,
                enumerable: false,
                writable: true,
                configurable: true
            }
        });
        if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
    }

    var Component = React.Component;

    var SubMenu = Menu.SubMenu;
    var MenuItemGroup = Menu.MenuItemGroup;

    var Page = function (_Component) {
        _inherits(Page, _Component);

        function Page() {
            _classCallCheck(this, Page);

            return _possibleConstructorReturn(this, Object.getPrototypeOf(Page).apply(this, arguments));
        }

        _createClass(Page, [{
            key: 'componentDidMount',
            value: function componentDidMount() {
                for (var i in this.refs) {
                    var ref = this.refs[i];
                    var block = ReactDOM.findDOMNode(ref);
                    SyntaxHighlighter.highlight({}, block);
                }
            }
        }, {
            key: 'switchTheme',
            value: function switchTheme(value) {
                this.refs.menu.setTheme(value ? "light" : "dark");
            }
        }, {
            key: 'openAndSelect',
            value: function openAndSelect() {
                if (this.lastSelect) {
                    this.refs.menu.selectItem(this.lastSelect.getKey());
                }
            }
        }, {
            key: 'select',
            value: function select(item) {
                this.lastSelect = item;
            }
        }, {
            key: 'switchTheme2',
            value: function switchTheme2(value) {
                this.refs.hmenu.setTheme(value ? "light" : "dark");
            }
        }, {
            key: 'render',
            value: function render() {
                return React.createElement(
                    'div',
                    { className: 'container' },
                    React.createElement(
                        Menu,
                        { style: { width: 300 },
                            onOpen: function onOpen(item) {
                                console.log(item);
                            },
                            onClick: function onClick() {
                                console.log("click");
                            },
                            onSelect: function onSelect() {
                                console.log("select");
                            },
                            unSelect: function unSelect() {
                                console.log("unSelect");
                            },
                            theme: 'dark'
                        },
                        React.createElement(
                            SubMenu,
                            { title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'th-large' }),
                                    'Menu One'
                                ) },
                            React.createElement(
                                MenuItemGroup,
                                { title: 'Item Group' },
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item1'
                                ),
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item2'
                                )
                            ),
                            React.createElement(
                                SubMenu,
                                { title: React.createElement(
                                        'span',
                                        null,
                                        'SubMenu'
                                    ) },
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item3'
                                ),
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item4'
                                )
                            )
                        ),
                        React.createElement(
                            SubMenu,
                            { title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'codepen' }),
                                    'Menu Two'
                                ), open: true },
                            React.createElement(
                                MenuItemGroup,
                                { title: 'Item Group' },
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item21'
                                ),
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item22'
                                )
                            )
                        )
                    ),
                    React.createElement(
                        'div',
                        { style: { padding: 30, background: "#fff" } },
                        React.createElement(
                            Menu,
                            { ref: 'hmenu', style: { marginTop: 30 }, layout: 'horizontal' },
                            React.createElement(
                                Menu.Item,
                                null,
                                React.createElement(FontIcon, { icon: 'th-large' }),
                                'Navigation One'
                            ),
                            React.createElement(SubMenu, { disabled: true, title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'codepen' }),
                                    'Navigation Two'
                                ) }),
                            React.createElement(
                                SubMenu,
                                { title: React.createElement(
                                        'span',
                                        null,
                                        React.createElement(FontIcon, { icon: 'codepen' }),
                                        'Navigation Three'
                                    ) },
                                React.createElement(
                                    MenuItemGroup,
                                    { title: 'Item 1' },
                                    React.createElement(
                                        Menu.Item,
                                        null,
                                        'item21'
                                    ),
                                    React.createElement(
                                        Menu.Item,
                                        null,
                                        'item22'
                                    )
                                ),
                                React.createElement(
                                    MenuItemGroup,
                                    { title: 'Item 2' },
                                    React.createElement(
                                        Menu.Item,
                                        null,
                                        'item21'
                                    ),
                                    React.createElement(
                                        Menu.Item,
                                        null,
                                        'item22'
                                    )
                                )
                            )
                        ),
                        React.createElement(Switch, { checkedText: 'dark', unCheckedText: 'light', onChange: this.switchTheme2.bind(this) })
                    ),
                    React.createElement(
                        Menu,
                        { ref: 'menu', style: { width: 300, marginTop: 30 }, modal: 'multi', theme: 'dark', onSelect: this.select.bind(this) },
                        React.createElement(
                            SubMenu,
                            { title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'th-large' }),
                                    'Navigation One'
                                ), open: true },
                            React.createElement(
                                Menu.Item,
                                null,
                                'item1'
                            ),
                            React.createElement(
                                Menu.Item,
                                null,
                                'item2'
                            ),
                            React.createElement(
                                SubMenu,
                                { title: React.createElement(
                                        'span',
                                        null,
                                        'SubMenu'
                                    ) },
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item3'
                                ),
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item4'
                                )
                            )
                        ),
                        React.createElement(
                            SubMenu,
                            { title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'codepen' }),
                                    'Navigation Two'
                                ) },
                            React.createElement(
                                MenuItemGroup,
                                { title: 'Item Group' },
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item21'
                                ),
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item22'
                                )
                            )
                        )
                    ),
                    React.createElement(Switch, { checkedText: 'dark', unCheckedText: 'light', onChange: this.switchTheme.bind(this) }),
                    React.createElement(
                        Button,
                        { onClick: this.openAndSelect.bind(this) },
                        '选中和打开初始节点'
                    ),
                    React.createElement(
                        Menu,
                        { style: { width: 300 },
                            layout: 'vertical'
                        },
                        React.createElement(
                            SubMenu,
                            { title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'th-large' }),
                                    'Menu One'
                                ) },
                            React.createElement(
                                Menu.Item,
                                null,
                                'item1'
                            ),
                            React.createElement(
                                Menu.Item,
                                null,
                                'item2'
                            ),
                            React.createElement(
                                SubMenu,
                                { title: React.createElement(
                                        'span',
                                        null,
                                        'SubMenu'
                                    ) },
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item3'
                                ),
                                React.createElement(
                                    Menu.Item,
                                    null,
                                    'item4'
                                )
                            )
                        ),
                        React.createElement(
                            SubMenu,
                            { title: React.createElement(
                                    'span',
                                    null,
                                    React.createElement(FontIcon, { icon: 'codepen' }),
                                    'Menu Two'
                                ) },
                            React.createElement(
                                Menu.Item,
                                null,
                                'item21'
                            ),
                            React.createElement(
                                Menu.Item,
                                null,
                                'item22'
                            )
                        )
                    )
                );
            }
        }]);

        return Page;
    }(Component);

    module.exports = Page;
});
